﻿using System;
using echarts.data;
using echarts.data.Entity;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTest
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            try
            {
                DataBase.Instance.DbMaintenance.CreateDatabase();
                DataBase.Instance.CodeFirst.InitTables(typeof(Order), typeof(ProductData));
                //var id = DataBase.Instance.Insertable(new Order() { Name = "order1", CustomId = 1, Price = 0, CreateTime = DateTime.Now }).ExecuteReturnIdentity();
                //var order = DataBase.Instance.Queryable<Order>().First();
                //var id = DataBase.Instance.Insertable(new ProductData()
                //{
                //    Province = "江苏",
                //    City = "常州",
                //    Name = "test",
                //    Address = "1123",
                //    Description = "111",
                //    Url = ""
                //}).ExecuteReturnIdentity();

                DataBase.Instance.Deleteable<ProductData>(it => it.Id == 1).ExecuteCommand();
                var order = DataBase.Instance.Queryable<ProductData>().First();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
    }
}
